﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace miSuperEngine
{
    public abstract class Actor
    {
        protected Vector2 position,speed;
        protected Animation anim;
        protected float rotation;
        protected Vector2 anchor;
        protected Vector2 acceleration;
        public Rectangle boundingBox;
        public Actor(Vector2 pos, Animation _anim)
        {
            position = pos;
            anim =_anim;
            //speed = Vector2.One;
            anchor = new Vector2(anim.getRect().Width/2,anim.getRect().Height/2);
            acceleration = Vector2.Zero;
            boundingBox.X = (int)position.X;
            boundingBox.Y = (int)pos.Y;
            boundingBox.Width = anim.getRect().Width;
            boundingBox.Height = anim.getRect().Height;
        }
        public virtual void update(GameTime gt)
        {
            anim.update(gt);
            speed += acceleration;
            position += speed;
            boundingBox.X = (int)position.X;
            boundingBox.Y = (int)position.Y;

        }
        public void draw(SpriteBatch sb)
        {
            sb.Draw(anim.texture, position, anim.getRect(), Color.White,MathHelper.ToRadians(rotation), anchor, 1, SpriteEffects.None, 0);
        }
    }
}
